{% extends "base.html" %}
{% block title %}主页{% endblock %}
{% block content %}
<h2>欢迎{{username}}来到图书管理系统</h2>
<p  style="text-align:right;margin-right: 300px;"><a href="{{ url_for('book_manage.book_add') }}">添加书籍</a></p>
<table style="width:100%;border:1px">
    <tr>
        <td>编号</td>
        <td>书名</td>
        <td>作者</td>
        <td>价格</td>
        <td>库存</td>
        <td>是否上架</td>
        <td>操作</td>
    </tr>
    {% for book in books %}
    <tr>
        <td>{{ book.id }}</td>
        <td>{{ book.name }}</td>
        <td>{{ book.author }}</td>
        <td>{{ book.price }}</td>
        <td>{{ book.available_count }}</td>
        <td>{{ book.is_active | is_active_filter }}</td>
        <td>
            <a href="{{ url_for('book_manage.book_edit', book_id=book.id) }}">编辑</a>
            <a href="{{ url_for('book_manage.book_delete', book_id=book.id) }}">删除</a>
        </td>
    </tr>
    {% endfor %}
</table>
<p>当前一共有{{books|length}}本书</p>

</br>

{% endblock %}